﻿using Missbot.Core.Base;
using Dolany.UtilityTool;
using JetBrains.Annotations;
using Missbot.AIModule.Gaming.Shopping;
using Missbot.AIModule.OnlineStore;

namespace Missbot.AIModule.Vip.VipArmers
{
    [UsedImplicitly]
    public class 黑金之匣 : IVipArmer
    {
        public string Name { get; set; } = "黑金之匣";
        public string Description { get; set; } = "随机获取一个稀有商店售卖的商品(仅在稀有商店开启时可用)，每天最多购买2次";
        public int DiamondsNeed { get; set; } = 180;
        public VipArmerLimitInterval LimitInterval { get; set; } = VipArmerLimitInterval.Daily;
        public int LimitCount { get; set; } = 2;

        public bool Purchase(InboxSession session)
        {
            var todayRec = DailySellItemRareDA.GetToday();
            if (!todayRec.IsActive)
            {
                session.SendBack("稀有商店尚未开启，你无法购买此物品！");
                return false;
            }

            var randItem = todayRec.Items.RandElement();
            var itemColle = ItemCollectionDA.Get(session.User.ID);
            var msg = itemColle.ItemIncome(randItem.Name);

            session.SendBack($"你获得了{randItem.Name}\n{msg}");
            return true;
        }

        public int MaxContains { get; set; }
    }
}